﻿using System;
using Abp.Authorization.Users;
using Abp.Domain.Entities;
using Abp.Extensions;

namespace shenghua.Authorization.Users
{
    public class User : AbpUser<User>, IExtendableObject
    {
        public const string DefaultPassword = "123qwe";

        public static string CreateRandomPassword()
        {
            return Guid.NewGuid().ToString("N").Truncate(16);
        }

        public static User CreateTenantAdminUser(int tenantId, string emailAddress)
        {
            var user = new User
            {
                TenantId = tenantId,
                UserName = AdminUserName,
                Name = AdminUserName,
                Surname = AdminUserName,
                EmailAddress = emailAddress
            };

            user.SetNormalizedNames();

            return user;
        }
        
        public string UserType { get; set; }

        public string Sex { get; set; }
        public string BirthYear { get; set; }
        public string BirthMonth { get; set; }
        public string BirthDay { get; set; }

        public bool IsStatic { get; set; }

        /// <summary>
        /// 头像
        /// </summary>
        public string Head { get; set; }

        public string ExtensionData { get; set; }

        public string Remark { get; set; }

        /// <summary>
        /// 职务
        /// </summary>
        public string Post { get; set; }

        public User()
        {
            UserType = Authorization.Users.UserType.User;
        }
    }
    
    public static class UserType
    {
        public readonly static string Admin = "admin";
        public readonly static string User = "user";
        public readonly static string Member = "member";
    }
}
